// Vision Zenith System Communication Protocol (Project)

#include "vzconn/base/helper.h"
#include <sstream>
namespace vzconn {
/*
static const int DEFAULT_RANDOM_LENGTH = 4;

const std::string GetRandomVzconnid() {
  static boost::int64_t start_id = 0;
  start_id++;

  std::stringstream ost;
  boost::random::random_device rng;
  boost::random::uniform_int_distribution<> index_dist(0, CHAR_SET.size() - 1);
  for (int i = 0; i < DEFAULT_RANDOM_LENGTH; ++i) {
    ost << CHAR_SET[index_dist(rng)];
  }
  ost << start_id;

  return ost.str();
}

const std::string GetRandomString(int size) {
  static boost::int64_t start_id = 0;
  start_id++;

  std::stringstream ost;
  boost::random::random_device rng;
  boost::random::uniform_int_distribution<> index_dist(0, CHAR_SET.size() - 1);
  for (int i = 0; i < size; ++i) {
    ost << CHAR_SET[index_dist(rng)];
  }
  ost << start_id;

  return ost.str();
}

const std::string GetRandomNumStr() {
  static boost::int32_t start_id = 1;

  std::stringstream ost;
  boost::random::random_device rng;
  boost::random::uniform_int_distribution<> index_dist(0, NUM_SET.size() - 1);
  for (int i = 0; i < 4; ++i) {
    ost << NUM_SET[index_dist(rng)];
  }
  ost << start_id++;

  return ost.str();
}

const std::string GetNewUUID() {
  boost::uuids::uuid a_uuid = boost::uuids::random_generator()();
  return boost::uuids::to_string(a_uuid);
}*/

const std::string IntToString(int n) {
  std::stringstream ss;
  ss << n;
  return ss.str();
}

const std::string NetAddrToIpcAddr(const std::string addr, int port) {
  std::stringstream ss;
  ss << "/tmp/";
  ss << "_";
  ss << port;
  ss << ".sock";
  return ss.str();
}

}; // namespace vzconn
